<template>
    <div id="app">
        <transition :name="transitionName">
            <router-view class="child-view"></router-view>
        </transition>
    </div>
</template>

<script>
export default {
  name: "App",
  data() {
    return {
      screenSwitch: false,
      screenSwitchCon: false,
      transitionName: "slide-left"
    };
  },
  methods: {
    
  },
  watch: {
      $route(to, from) {
        if (to.meta.index < from.meta.index) {
          this.transitionName = "slide-right";
        } else {
          this.transitionName = "slide-left";
        }
      }
    }
};
</script>

<style lang="less">
@import url(./assets/less/config.less);
@import url(./assets/less/public.less);
#app {
  font-family: 'Trebuchet MS', 'Lucida Sans Unicode', 'Lucida Grande', 'Lucida Sans', Arial, sans-serif;
  @font14();
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
    .child-view {
    position: absolute;
    width: 100%;
    transition: all.8s cubic-bezier(0.55, 0, 0.1, 1);
  }
  .slide-left-enter,
  .slide-right-leave-active {
    opacity: 0;
    transform: translate(100%, 0);
  }
  .slide-left-leave-active,
  .slide-right-enter {
    opacity: 0;
    transform: translate(-100%, 0);
  }
}
</style>
